1. Field of the Invention
The present invention relates to a method, system, and program for automatic adjustment of time a consumer waits to access data from a queue during a waiting phase and transmission phase at the queue.
2. Description of the Related Art
In the current art, once a process or thread, i.e., consumer, has requested data in a queue managed by another process or thread, i.e., a producer, the consumer may then periodically poll the producer queue to determine whether there is data to access. A queue comprises a data structure used to sequence multiple demands for a resource, such as storage resources, computational resources, printing resources, etc. Requests in a queue may be processed in a first-in-first-out (FIFO) ordering. If data is not available at the producer queue, then the consumer goes into a wait state and then again checks the producer queue after the wait time. If the consumer polls the producer queue at too frequent of a time interval before data is available, then needless polling requests are issued, thus wasting the consumer resources expended to issue the polling requests and the producer resources used to respond in the negative to the polling request. On the other hand, if the consumer polls the producer queue at too infrequent of a time interval, then data may not be accessed and removed from the queue at a sufficiently frequent rate to leave room in the queue for further data. In such case, the producer cannot accept further data, which may cause problems for processes sending the producer data.